﻿using System;
using System.Collections.Generic;
using Storm.TextEditor.Editor;
using Storm.TextEditor.Parser.Objects.Collections;

namespace Storm.TextEditor.Parser.Objects
{
    /// <summary>
    /// Represents a scope in a Block.
    /// </summary>
    public sealed class Scope
    {
        #region Fields

        private Pattern start = null;
        private PatternCollection endPatterns = new PatternCollection();

        private Block spawnBlockOnStart = null;
        private Block spawnBlockOnEnd = null;
        private Block parent = null;

        private TextStyle style = null;
        private string expansionText = "";
        private List<string> modifiers = new List<string>();

        private bool defaultExpanded = true;
        private bool indenter = false;
        private bool caseSensitive = false;
        private bool normalizeCase = true;
        private bool causeIndent = false;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the starting Pattern of the Scope.
        /// </summary>
        public Pattern Start
        {
            get { return start; }
            set { start = value; }
        }

        /// <summary>
        /// Gets or sets the collection of Patterns that the define the ending Patterns of the Scope.
        /// </summary>
        public PatternCollection EndPatterns
        {
            get { return endPatterns; }
            set { endPatterns = value; }
        }

        /// <summary>
        /// Gets or sets the Block that the Scope spawns on start.
        /// </summary>
        public Block SpawnBlockOnStart
        {
            get { return spawnBlockOnStart; }
            set { spawnBlockOnStart = value; }
        }

        /// <summary>
        /// Gets or sets the Block that the Scope spawns on end.
        /// </summary>
        public Block SpawnBlockOnEnd
        {
            get { return spawnBlockOnEnd; }
            set { spawnBlockOnEnd = value; }
        }

        /// <summary>
        /// Gets or sets the parent Block of the Scope.
        /// </summary>
        public Block Parent
        {
            get { return parent; }
            set { parent = value; }
        }

        /// <summary>
        /// Gets or sets the TextStyle of the Scope.
        /// </summary>
        public TextStyle Style
        {
            get { return style; }
            set { style = value; }
        }

        /// <summary>
        /// Gets or sets the text of the Scope when it's folded.
        /// </summary>
        public string ExpansionText
        {
            get { return expansionText; }
            set { expansionText = value; }
        }

        /// <summary>
        /// Gets or sets the list of available modifiers for this scope.
        /// </summary>
        public List<string> Modifiers
        {
            get { return modifiers; }
            set { modifiers = value; }
        }

        /// <summary>
        /// Gets or sets whether the Scope is expanded as default.
        /// </summary>
        public bool DefaultExpanded
        {
            get { return defaultExpanded; }
            set { defaultExpanded = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Scope"/> is an indenter.
        /// </summary>
        public bool Indenter
        {
            get { return indenter; }
            set { indenter = value; }
        }

        /// <summary>
        /// Gets or sets whether the Scope is case sensitive.
        /// </summary>
        public bool CaseSensitive
        {
            get { return caseSensitive; }
            set { caseSensitive = value; }
        }

        /// <summary>
        /// Gets or sets whether the Scope should normalize case.
        /// </summary>
        public bool NormalizeCase
        {
            get { return normalizeCase; }
            set { normalizeCase = value; }
        }

        /// <summary>
        /// Gets or sets whether the Scoep should cause indentation.
        /// </summary>
        public bool CauseIndent
        {
            get { return causeIndent; }
            set { causeIndent = value; }
        }

        #endregion

        /// <summary>
        /// Initializes a new instance of Scope.
        /// </summary>
        public Scope()
        {
        }
    }
}
